package cn.hello2018.sdk.response;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author jeymingwu
 * @date 2019/5/8 15:38
 */
public class AlertResponse {

    public static String openAlertResponse(HttpServletResponse response, String msg, String url) throws IOException {
        response.setCharacterEncoding("utf-8");
        PrintWriter out = response.getWriter();
        out.print("" +
                "<html>" +
                "   <head>" +
                "       <meta charset=\"UTF-8\">" +
                "       <title>创建订单</title>" +
                "   </head>" +
                "   <body>" +
                "   <script type='text/javascript'>" +
                "       alert('" + msg + "');" +
                "       window.location.href='" + url + "';" +
                "   </script>" +
                "   </body>" +
                "</html>");
        out.flush();
        out.close();
        return url;
    }
}
